package com.ycz.pattern.create.abstractfactorypattern;

import com.ycz.pattern.create.abstractfactorypattern.colorabout.Color;
import com.ycz.pattern.create.abstractfactorypattern.shapeabout.Circle;
import com.ycz.pattern.create.abstractfactorypattern.shapeabout.Rectangle;
import com.ycz.pattern.create.abstractfactorypattern.shapeabout.Shape;
import com.ycz.pattern.create.abstractfactorypattern.shapeabout.Square;

/**
 * @Description
 * @ClassName ShapeFactory
 * @Author yanchengzhi
 * @date 2023.11.20 00:54
 */
public class ShapeFactory extends AbstractFactory {
    @Override
    public Color getColor(String color) {
        return null;
    }

    @Override
    public Shape getShape(String shape) {
        if(shape == null) return null;
        if("circle".equalsIgnoreCase(shape)) {
            return new Circle();
        } else if("rectangle".equalsIgnoreCase(shape)) {
            return new Rectangle();
        } else if("square".equalsIgnoreCase(shape)) {
            return new Square();
        }
        return null;
    }
}
